package com.java.demo.component;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class BeanCompont implements BeanNameAware {
    //通知
    @Override
    public void setBeanName(String s){
        System.out.println("执行了通知BeanName ——>" + s);
    }
    //xml方式的初始化方法
    public void myInit(){
        System.out.println("XML方式初始化");
    }
    //注解方式的初始化
    @PostConstruct
    public void doPostConstruct(){
        System.out.println("注解的初始化方法");
    }

    public static void sayHi(){
        System.out.println("执行sayHi方法");
    }
    @PreDestroy
    public void doPreDestory(){
        System.out.println("do PreDestory");
    }
}
